<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>组件化</title>
		<script type="text/javascript" src="js/vue.js" ></script>
	</head>
	<body>
		<div id="root">
			<input type="text" v-model="inputValue"/>
			<button v-on:click="handleBtnClick">提交</button>
			<ul>
				<!--<li v-for="item in list">{{item}}</li>-->
				<todo-item v-bind:content='item'
							v-for='item in list'>
					
				</todo-item>
				
			</ul>
			
	 
		</div>
		<script>
/* 			Vue.component('TodoItem',{
				props:['content'],
				template:'<li>{{content}}</li>'
			}) */
			
			var TodoItem={
				props:['content'],
				template:'<li>{{content}}</li>'
			}
			
			var app=new Vue({
				el:'#root',
				components:{
					TodoItem:TodoItem
				},
				data:{
					list:[],
					inputValue:''
				},
				methods:{
					handleBtnClick:function(){
						 this.list.push(this.inputValue)
						 this.inputValue=''
					}
				}
			})
		 
			
			
	</script>
	</body>
</html>
